#ifndef MX35DVR_H
#define MX35DVR_H

#define DRIVER_NAME "mx51dvr"
#define DEVICE_NAME "/dev/mx51dvr"


enum {
 GPIO_DIR_INPUT,
 GPIO_DIR_OUTPUT
};

typedef struct{
    int dir;
	int gpio;
	int val;
}GPIOVAL_t;

typedef struct {
	int pwmid;
	int duty_ns;
	int period_ns;
}PWMVAL_t;

typedef struct {
		int adapter;
		int addr;
		int flags;
		int count;
		unsigned char buf[12];
}I2CVAL_t ;

typedef struct{
  unsigned int addr;
  unsigned int val;
}REGVAL_t;

typedef struct {
   unsigned char buff[8];
   unsigned int  len;
}BUFF_t ;

typedef struct {
	int x;
	int y;
	int z;
}ACCXYZ_t;

typedef struct {
	unsigned datamask_en:1;
	unsigned ext_clk:1;
	unsigned interlaced:1;
	unsigned odd_field_first:1;
	unsigned clksel_en:1;
	unsigned clkidle_en:1;
	unsigned data_pol:1;	/* true = inverted */
	unsigned clk_pol:1;	/* true = rising edge */
	unsigned enable_pol:1;
	unsigned Hsync_pol:1;	/* true = active high */
	unsigned Vsync_pol:1;
	
} ipu_di_signal_cfg_t;


typedef struct{
	int disp;
	unsigned int pixclock;
	int w,h;
	unsigned int fmt;
	int left_margin;
	int hsync_len;
	int right_margin;
	int upper_margin;
	int vsync_len;
	int lower_margin;
	unsigned int sig;
}ipudisp_t;


typedef struct{
	int length;
	unsigned char buff[256];
}SPIIO_t;



#define DRIVER_gpio_get_value   	_IOWR ('I',  0,GPIOVAL_t)
#define DRIVER_gpio_set_value   	_IOW  ('I',  1,GPIOVAL_t )
#define DRIVER_gpio_dir				_IOW  ('I',  2,GPIOVAL_t )
#define DRIVER_pwd_beep				_IOW  ('I',  3,PWMVAL_t )
#define DRIVER_pwd_enable			_IO   ('I',  5 )
#define DRIVER_pwd_disable			_IO   ('I',  6 )
#define DRIVER_mmc_force_detect		_IOW  ('I',  7,int )
#define DRIVER_power_down			_IO	  ('I',  8)	
#define DRIVER_wait_power_key		_IO	  ('I',  9)	
#define DRIVER_usb_power_off        _IO	  ('I',  10)
#define DRIVER_usb_power_on         _IO   ('I',  11)
#define DRIVER_I2C_IO				_IOWR ('I',  12,I2CVAL_t)
#define DRIVER_DUMP_IPU_REGS		_IO   ('I',  13)
#define DRIVER_WRITE_REG32			_IOWR ('I',  14,REGVAL_t)	
#define DRIVER_READ_REG32			_IOWR ('I',  15,REGVAL_t)	
#define DRIVER_READ_SPI             _IOWR ('I',  16,BUFF_t)	
#define DRIVER_WRITE_SPI            _IOWR ('I',  17,BUFF_t)	
#define DRIVER_REG_WRITE_SPI		_IOWR ('I',  18,REGVAL_t)	
#define DRIVER_GSENS_CONF			_IOW  ('I',  19,int )
#define DRIVER_IPU_DISP				_IOWR ('I',  20,ipudisp_t )
#define DRIVER_PMIC_READ			_IOWR ('I',  21,REGVAL_t )
#define DRIVER_PMIC_WRITE			_IOWR ('I',  22,REGVAL_t )
#define DRIVER_ACC_GXYZ				_IOWR ('I',  23,ACCXYZ_t )
#define DRIVER_SPI_WRITE			_IOWR ('I',  24,SPIIO_t )
#define DRIVER_SPI_READ				_IOWR ('I',  25,SPIIO_t )
#define DRIVER_SPI_CLOCK			_IOW  ('I',  26,int )
#define DRIVER_SPI_STATUS			_IOWR ('I',  27,int )



#endif




